<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>易能旅游网站--预定线路</title>
	<%@ include file="/pages/common/common_f.jsp" %>	

	<script type="text/javascript">
		$(function(){	
				
		});
		
		/** 设置资源 */
		function setRes(cityId,resType,title,routeDetailId){
			$("#settingWin").window({
		  		title:title,
		  		href:'${ctx}/res/toResList.usr?resType='+resType+'&cityId='+cityId+"&routeDetailId="+routeDetailId,
		  		width:480,
		  		height:270
  			});
		}	
		
		/** 查看详情 */
		function showDetail(cityId,resType,resId){
			$("#detailWin").window({
				title:'详细信息',
		  		href:'${ctx}/res/showDetail.usr?resType='+resType+'&cityId='+cityId+'&resId='+resId,
		  		width:400,
		  		height:370
  			});
		}
		
		/** 添加晚宿 */
		function addNight(routeDetailId){
			$.post('${ctx}/res/addNight.usr?routeDetailId='+routeDetailId,function(data){
				if(data.success){
					location.href='${ctx}/route/queryRoute.usr?routeId=${routeId}&type=${type}&back=0';
				}else{
					alert('添加晚宿失败，将重新加载线路');
					location.href='${ctx}/route/queryRoute.usr?routeId=${routeId}&type=${type}';
				}
			});
		}
		
		/** 删除晚宿 */
		function delNight(routeDetailId){
			//alert(routeDetailId);
			$.post('${ctx}/res/delNight.usr?routeDetailId='+routeDetailId,function(data){
				if(data.success){
					location.href='${ctx}/route/queryRoute.usr?routeId=${routeId}&type=${type}&back=0';
				}else{
					alert('删除晚宿失败，将重新加载线路');
					location.href='${ctx}/route/queryRoute.usr?routeId=${routeId}&type=${type}';
				}
			});
		}
				
	</script>	
	<style type="text/css">
		/* 线路基本信息 */
		.routeinfo{
			border: 1px solid #99BBE8;
			padding: 5px;
		}
		td.itemname{
			width: 65px;
			color: #15428B;
		}
		
		/* 资源定制 */
		td.setrec{
			width: 80px;
			text-align: right;
			color: #15428B;
		}
		
		
	</style>
  </head>
  <body style="margin:0;padding:0;height:100%;overflow:scroll;background:#F2FBFF">
  	<div class="main">
		<jsp:include page="/pages/front/inc/header.jsp"></jsp:include><!-- 顶部导航 -->
		<div class="info">
			<span class="location"><span style="font-weight: bold;">位置：</span>首页>${countryName}>${route.orgCityCn}>自助估价><c:if test="${type eq constant.GROUP_TYPE_SIX}">1-6人团</c:if><c:if test="${type eq constant.GROUP_TYPE_SEVEN}">7-38人团</c:if></span>
			<span class="user"><jsp:include page="/pages/front/inc/login_info.jsp"/></span>
		</div>
		<div class="content">
			<div class="left">
				<jsp:include page="/country/queryAll.usr"></jsp:include><!-- 左侧国家 -->
			</div>
			<div class="right" id="right">
				<!-- 右侧内容区域 -->
				<div style="margin: 5px;">
					<div class="easyui-panel" style="padding: 5px;" title="标准配套价格（人民币/每人/每套）" collapsible="false" minimizable="false" maximizable="false" closable="false">
						<table id="tt" class="easyui-datagrid" singleSelect="true" style="height:auto;">  
						    <thead>  
						        <tr>
						        	<th field="人数" width="70" align="right">人数</th>
						        <c:forEach items="${spt.columns}" var="col">  
						            <th field="${col}" align="center" width="70">${col}</th>  
						        </c:forEach>                          
						        </tr> 
						    </thead>                             
						    <tbody> 
						    <c:forEach items="${spt.datas}" var="data" varStatus="s">                             
						        <tr>
						        <td>${spt.rowTypes[s.index]}</td>
						        <c:forEach items="${data}" var="price">
						            <td><fmt:formatNumber value="${price}" pattern="0"/></td>
						        </c:forEach>           
						        </tr>
						    </c:forEach>                         
						    </tbody>                             
						</table>  	
					</div><!-- end panel -->
				</div>
				<div style="margin: 5px;">
					<div class="easyui-panel" style="padding: 5px;" title="线路行程详情" collapsible="false" minimizable="false" maximizable="false" closable="false">
						<div class="routeinfo">
							<table>
								<tr>
									<td class="itemname">线路名称：</td>
									<td>${route.routeName}</td>
								</tr>
								<tr>
									<td class="itemname">线路时长：</td>
									<td>${route.day }天${route.night }夜</td>
								</tr>
								<tr>
									<td  class="itemname" valign="top">线路介绍：</td>
									<td>${route.remark}</td>
								</tr>
							</table>
						</div>
						<div class="easyui-accordion" animate="false">
							<c:forEach items="${details}" var="detail" varStatus="ss">
							<div title="第${ss.count }天：${detail.routeDetail.depart} - ${detail.routeDetail.arrivel}(目的地：${detail.routeDetail.cityCn})<c:if test="${fn:contains(detail.routeDetail.detailId, 'NW')}"><span style='float:right;margin-right:25px;''>[<a style='color:red;' href='javascript:void(0);' onclick=delNight('${detail.routeDetail.detailId}')>删除晚宿<a>]<span></c:if>" style="overflow:hidden;padding: 5px;">
								<table class="mytable" cellspacing="0">
									<tr>
										<td width="60px;">住宿：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_HOTEL}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_HOTEL}">
											${res.resource.hotelName}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_HOTEL},'定制住宿','${detail.routeDetail.detailId}');">定制</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>活动：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_ACTIVITY}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_ACTIVITY}">
											${res.resource.activityName}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_ACTIVITY},'添加活动','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr>
										<td>早餐：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_ZAOCAN}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_ZAOCAN}">
											${res.resource.repastWhat}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_ZAOCAN},'添加早餐','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>午餐：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_WUCAN}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_WUCAN}">
											${res.resource.repastWhat}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_WUCAN},'添加午餐','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr>
										<td>晚餐：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_WANCAN}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_WANCAN}">
											${res.resource.repastWhat}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_WANCAN},'添加晚餐','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>接送：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_CAR}">散拼</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_CAR},'定制接送','${detail.routeDetail.detailId}');">定制</a>]</td>
									</tr>
									<tr>
										<td>导游：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_GUIDE}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_GUIDE}">
											<c:if test="${res.resource.guideLan eq 0}">中文&nbsp;</c:if>
											<c:if test="${res.resource.guideLan eq 1}">中文&nbsp;</c:if>
											<c:if test="${res.resource.guideLan eq 2}">中文&nbsp;</c:if>
											</c:if>
										</c:forEach>
										</td>
										<c:choose>
										<c:when test="${routeVo.groupType eq constant.GROUP_TYPE_SIX}">
											<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_GUIDE},'添加导游','${detail.routeDetail.detailId}');">添加</a>]</td>
										</c:when>
										<c:when test="${routeVo.groupType eq constant.GROUP_TYPE_SEVEN}">
											<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_GUIDE},'定制导游','${detail.routeDetail.detailId}');">定制</a>]</td>
										</c:when>
										</c:choose>
									</tr>
									<tr class="rowalt2">
										<td>购物：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_SHOPPING}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_SHOPPING}">
											${res.resource.spAddr}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_SHOPPING},'添加购物','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr>
										<td >其他：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_OTHER}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_OTHER}">
											${res.resource.otherName}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_OTHER},'添加其他','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>&nbsp;</td>
										<td>&nbsp;</td>
										<td class="setrec">[<a href="javascript:void(0);" onclick="addNight('${detail.routeDetail.detailId}');">添加晚宿</a>]</td>
									</tr>
								</table>
							</div>
							</c:forEach>
						</div>
					</div>
				</div>	<!-- end route -->		
				<div style="text-align: center;margin-top: 10px;">
					<a style="text-decoration: none;" onclick="location.href='${ctx}/book/toBook.usr'" class="easyui-linkbutton" iconCls="icon-redo">下一步</a>
				</div>
			</div><!-- end right -->
			<div class="vertical-border"></div><!-- center border-line -->
		</div><!-- end content -->
	</div><!-- end main -->
	<div id="settingWin" modal="true" shadow="false" minimizable="false" cache="false" maximizable="false" collapsible="false" resizable="true" style="margin: 0px;padding: 0px;overflow: auto;"></div>
	<div id="detailWin" modal="true" shadow="false" minimizable="false" cache="false" maximizable="false" collapsible="false" resizable="true" style="margin: 0px;padding: 0px;overflow: auto;"></div>
</body>

</html>
